/**
 * Copyright 2006-2015 handu.com
 * <p/>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.iepacj.amqp.handler;

import com.alibaba.fastjson.JSON;
import com.iepacj.vo.Community;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;

//import com.iepacj.service.RabbitmqService;

/**
 * @author amssy
 * @version V1.0
 * @description TODO
 * @date 2016/4/23
 */
public class InquiryMessageHandler{

    private static final Logger logger = LoggerFactory.getLogger(InquiryMessageHandler.class);

    //private @Autowired RabbitmqService rabbitmqService;

    @Transactional(rollbackFor = {Exception.class})
    public void process(String message) {
        try {
            //logger.info("队列消息处理 @ {}", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
            //logger.info("接受到的消息::{}-{}", Thread.currentThread().getName(), message);

            Community community = JSON.parseObject(message, Community.class);

            //rabbitmqService.saveCommunity(community);

            //logger.info("消息处理结束::{}-{}", Thread.currentThread().getName(), message);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
